import java.io.*;

public class ShellUtils {
    public static String convertStreamToStr(InputStream is) throws IOException {
        InputStreamReader isr = new InputStreamReader(is,"GBK");
        BufferedReader br = new BufferedReader(isr);
        StringBuilder sb = new StringBuilder();
        String line;
        while (( line = br.readLine()   ) != null) {
            sb.append(line).append("\n");
        }
        return sb.toString();
    }
             public static String run(String cmd){
                 try {
                     String res = convertStreamToStr(Runtime.getRuntime().exec(cmd,null,null).getInputStream());
                     return res;
                 } catch (IOException e1) {
                     e1.printStackTrace();
                 }
                 return "";
             }

}
